/*    */ package com.zimbra.cs.redolog.op;
/*    */ 
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.cs.mailbox.MailServiceException.NoSuchItemException;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.MailboxOperation;
/*    */ import com.zimbra.cs.redolog.RedoLogInput;
/*    */ import com.zimbra.cs.redolog.RedoLogOutput;
/*    */ import java.io.IOException;
/*    */ import java.util.Arrays;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class DeleteItemFromDumpster
/*    */   extends RedoableOp
/*    */ {
/*    */   private int[] mIds;
/*    */   
/*    */   public DeleteItemFromDumpster()
/*    */   {
/* 35 */     super(MailboxOperation.DeleteItemFromDumpster);
/*    */   }
/*    */   
/*    */   public DeleteItemFromDumpster(int mailboxId, int[] ids) {
/* 39 */     this();
/* 40 */     setMailboxId(mailboxId);
/* 41 */     this.mIds = ids;
/*    */   }
/*    */   
/*    */   protected String getPrintableData() {
/* 45 */     StringBuffer sb = new StringBuffer("ids=");
/* 46 */     sb.append(Arrays.toString(this.mIds));
/* 47 */     return sb.toString();
/*    */   }
/*    */   
/*    */   protected void serializeData(RedoLogOutput out) throws IOException {
/* 51 */     out.writeInt(this.mIds.length);
/* 52 */     for (int id : this.mIds)
/* 53 */       out.writeInt(id);
/*    */   }
/*    */   
/*    */   protected void deserializeData(RedoLogInput in) throws IOException {
/* 57 */     this.mIds = new int[in.readInt()];
/* 58 */     for (int i = 0; i < this.mIds.length; i++)
/* 59 */       this.mIds[i] = in.readInt();
/*    */   }
/*    */   
/*    */   public void redo() throws Exception {
/* 63 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
/*    */     try
/*    */     {
/* 66 */       mbox.deleteFromDumpster(getOperationContext(), this.mIds);
/*    */     } catch (MailServiceException.NoSuchItemException e) {
/* 68 */       if (mLog.isInfoEnabled())
/* 69 */         mLog.info("Some of the items being deleted were already deleted from dumpster " + getMailboxId());
/*    */     }
/*    */   }
/*    */   
/*    */   public boolean isDeleteOp() {
/* 74 */     return true;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/DeleteItemFromDumpster.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */